package com.jq.invoicing.test.action;

import java.util.List;

import com.jq.invoicing.test.service.ISysuserService;
import com.jq.invoicing.test.vo.Person;
import com.jq.invoicing.utils.PageUtils;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class ListPersonPagesAction extends ActionSupport implements ModelDriven<Person> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1992056494807966778L;

    private Integer total;  
    private Integer pageNo=1;
    private Person p = new Person();
    private List<Person> l;
    
    private ISysuserService sysuserService;
    
    public Person getModel() {
        // TODO Auto-generated method stub
        return p;
    }
    
    public String execute(){
    	try {
			l = sysuserService.get(p, pageNo, PageUtils.PAGESIZE);
			int totalNumber = sysuserService.getCount(p);
			total = PageUtils.getTotalPage(totalNumber, PageUtils.PAGESIZE);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        return SUCCESS;  
    }  
    
    public Integer getTotal() {  
        return total;  
    }  
  
    public void setTotal(Integer total) {  
        this.total = total;  
    }  
  
    public Integer getPageNo() {  
        return pageNo;  
    }  
  
    public void setPageNo(Integer pageNo) {  
        this.pageNo = pageNo;  
    }  
 
	public ISysuserService getSysuserService() {
		return sysuserService;
	}
	public void setSysuserService(ISysuserService sysuserService) {
		this.sysuserService = sysuserService;
	}

	public List<Person> getL() {
		return l;
	}
	public void setL(List<Person> l) {
		this.l = l;
	}
   
}
